package org.net;

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.util.*;
import org.net.Login;

public class Login {
    //private static Component abcca;
    private JTextField textField1;
    private JButton loginButton;
    private JPanel abcc;
    static String IF_EXIT = "true";

    public Login() {
        loginButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                //检查IP
                //动态获取IP
                String ip = textField1.getText();
                ChatWindow chatwindow = new ChatWindow();
            }
        });
    }

    public static void main(String[] args) {
        LoginWindow("S"); //启动登入界面
    }

    public static void LoginWindow(String A) {
        JFrame frame = new JFrame("Login Your IP - JChat I");
        frame.setContentPane((Container) new Login().abcc);
        frame.setSize(300, 200);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //frame.pack();
        frame.setVisible(true);
        if (A == "S") {
            //mainloop
        }
        if (A == "B") {
            //JOptionPane.showMessageDialog(abcca, "你的电脑是我的了!");
            frame.dispose();
        }
    }
}
